
package com.phm.phmneuron;

import java.util.HashMap;
import java.util.Set;

/**
 *
 * @author Parham Nooralishahi - PHM!
 */
public class ParametersContainer extends HashMap<Integer, Object> {
    
    public void updateParameter (int key, Object value) {
        this.put(key, value);
    }
    public Object removeParameter (int key) {
        return this.remove(key);
    }
    public Object getParameter (int key) {
        return this.get(key);
    }
    public boolean containsParameter (int key) {
        return this.containsKey(key);
    }
    public Set<Integer> getParameterKeys () {
        return this.keySet();
    }
    public int countParameters () {
        return this.size();
    }
    
    public boolean processOnParameter (int key, ProcessOnParameter process) {
        Object value = getParameter(key);
        if (value == null) return false;
        Object result = process.process(value, this);
        updateParameter(key, result);
        return true;
    }
}
